import 'package:flutter/material.dart';

import '../../utils/tools/localstorage_tool.dart';
import '../../utils/tools/screenutil_tool.dart';
import '../../utils/widget/appbar_widget.dart';
class IntroduceView extends StatefulWidget {
  @override
  IntroduceViewState createState() => new IntroduceViewState();
}

class IntroduceViewState extends State<IntroduceView> {
  // 系统版本
  String version;

  // 左右边距
  double lrp = 25;

  // 上下边距
  double tbp = 10;

  StrutStyle strutStyle = StrutStyle(forceStrutHeight: true, height:1, leading: .8);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarWidget("关于App", isShowRI: false).build(context),
      body: SingleChildScrollView(
        child: Container(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                width: double.infinity,
                alignment: Alignment.topLeft,
                padding: EdgeInsets.only(left: ST.setw(lrp),right: ST.setw(lrp),top: ST.seth(tbp)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text("版本信息",style: TextStyle(fontWeight: FontWeight.bold)),
                    Text("  $version", strutStyle: strutStyle),
                  ],
                ),
              ),
              Container(
                width: double.infinity,
                alignment: Alignment.topLeft,
                padding: EdgeInsets.only(left: ST.setw(lrp),right: ST.setw(lrp),top: ST.seth(tbp)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text("运行环境",style: TextStyle(fontWeight: FontWeight.bold)),
                    Text("  Android 8+、IOS 9+", strutStyle: strutStyle),
                  ],
                ),
              ),
              Container(
                width: double.infinity,
                alignment: Alignment.topLeft,
                padding: EdgeInsets.only(left: ST.setw(lrp),right: ST.setw(lrp),top: ST.seth(tbp)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text("运行要求",style: TextStyle(fontWeight: FontWeight.bold)),
                    Text("  确保App在网络通畅的情况下运行。支持WIFI、移动数据、网络热点三种方式。"
                            "注：建议设备在连接WIFI的情况下运行。", strutStyle: strutStyle),
                  ],
                ),
              ),
              Container(
                width: double.infinity,
                alignment: Alignment.topLeft,
                padding: EdgeInsets.only(left: ST.setw(lrp),right: ST.setw(lrp),top: ST.seth(tbp)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text("功能介绍",style: TextStyle(fontWeight: FontWeight.bold)),
                    Text("  1、声纹异常监听",strutStyle: strutStyle),
                    Text("  2、跌落开关异常监听",strutStyle: strutStyle),
                    Text("  3、无线无缘测温异常监听",strutStyle: strutStyle),
                    Text("  4、环境温湿度异常监听",strutStyle: strutStyle),
                    Text("  5、水浸异常监听",strutStyle: strutStyle)
                  ],
                ),
              )
            ],
          ),
        ),
      ),
    );
  }

  /// 获取系统版本
  void getVersionInfo() async {
    // 存储版本信息
    String v = await LocalStorage.getStringItem("version");
    setState(() {
      version = v == null ? "检查不到系统版本" : v;
    });
  }

  @override
  void initState() {
    super.initState();
    getVersionInfo();
  }

}